package cn.xdmnb.cloud.blog.core.util;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import java.util.Objects;

/**
 * @author yukai
 * @since 2023年01月05日 16:08
 */
public class RequestContextUtil {

    public static HttpServletRequest getRequest(){
        return ((ServletRequestAttributes) (Objects.requireNonNull(RequestContextHolder.getRequestAttributes()))).getRequest();
    }

}
